<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>收派时间管理</title>
		<!-- 导入jquery核心类库 -->
		<script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
		<!-- 导入easyui类库 -->
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../js/easyui/ext/portal.css">
		<link rel="stylesheet" type="text/css" href="../../css/default.css">
		<script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../js/easyui/ext/jquery.portal.js"></script>
		<script type="text/javascript" src="../../js/easyui/ext/jquery.cookie.js"></script>
		<script src="../../js/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
		<script type="text/javascript">
			$(function(){
				// 先将body隐藏，再显示，不会出现页面刷新效果
				$("body").css({visibility:"visible"});
				
				// 收派时间管理信息表格
				$('#grid').datagrid( {
					iconCls : 'icon-forward',
					fit : true,
					border : false,
					rownumbers : true,
					striped : true,
					pageList: [30,50,100],
					pagination : true,
					toolbar : toolbar,
					url : "../../takeTimeFindAll.action",
					idField : 'id',
					columns : columns
				});
			});	
			
			//工具栏
			var toolbar = [ {
				id : 'button-add',
				text : '增加',
				iconCls : 'icon-add',
				handler : function(){
					//alert('ze');
					$("#addWindow").form('clear');
					$("#addWindow").window('open');
				}
			}, {
				id : 'button-edit',
				text : '修改',
				iconCls : 'icon-edit',
				handler : function(){
					var row = $("#grid").datagrid('getSelections');
					if(row.length == 1){
						var b = row[0];
						$("#myForm").form('load',b);
						$("#addWindow").window("open");
					}else{
						$.messager.alert("警告",'请选择一组数据',"warning");
					}
					
				}
			},{
				id : 'button-delete',
				text : '删除',
				iconCls : 'icon-cancel',
				handler : function(){
					var row = $("#grid").datagrid('getSelections');
					if(row.length == 0){
						$.messager.alert('警告',"请选择最少一组数据","warning");
						
					}else{
						var a = new Array();
						$.each(row,function(i,n){
							a.push(n.id);
						})
						var b = a.join(',');
						window.location.href="../../doDelete.action?ids=" + b;
					}
				}
			} ];
			
			// 定义列
			var columns = [ [ {
				field : 'id',
				checkbox : true,
			},{
				field : 'name',
				title : '时间名称',
				width : 120,
				align : 'center'
			}, {
				field : 'normalWorkTime',
				title : '平时上班时间',
				width : 120,
				align : 'center'
			}, {
				field : 'normalDutyTime',
				title : '平时休息时间',
				width : 120,
				align : 'center'
			}, {
				field : 'satWorkTime',
				title : '周六上班时间',
				width : 120,
				align : 'center'
			}, {
				field : 'satDutyTime',
				title : '周六休息时间',
				width : 120,
				align : 'center'
			}, {
				field : 'sunWorkTime',
				title : '周日上班时间',
				width : 120,
				align : 'center'
			}, {
				field : 'sunDutyTime',
				title : '周日休息时间',
				width : 120,
				align : 'center'
			}, {
				field : 'status',
				title : '状态',
				width : 120,
				align : 'center'
			}, {
				field : 'company',
				title : '所属单位',
				width : 120,
				align : 'center'
			} , {
				field : 'operator',
				title : '操作人',
				width : 120,
				align : 'center'
			}, {
				field : 'operatingTime',
				title : '操作时间',
				width : 120,
				align : 'center'
			}, {
				field : 'operatingCompany',
				title : '操作单位',
				width : 120,
				align : 'center'
			} ] ];
			$(function(){
				$("#save").click(function(){
					if($("#myForm").form('validate')){
						$("#myForm").submit();
						//$("grid").datagrid('reload');
						$("#addWindow").close;
					}else{
						$.messager.alert("警告","请完整录入表格","warning");
					}
				})
			})
		</script>
	</head>
	<body class="easyui-layout" style="visibility:hidden;">
		<div region="center" border="false">
			<table id="grid"></table>
		</div>
		<div class="easyui-window" title="受派时间添加修改" id="addWindow" collapsible="false" minimizable="false" maximizable="false" closed="true" style="top:20px;left:200px">
			<div style="height:31px;overflow:hidden;" split="false" border="false">
				<div class="datagrid-toolbar">
					<a id="save" icon="icon-save" href="#" class="easyui-linkbutton" plain="true">保存</a>
				</div>
			</div>

			<div style="overflow:auto;padding:5px;width:500px" border="false">
				<form id="myForm" method="post" action="../../addTakeTime.action">
					<table class="table-edit" width="80%" align="center">
						<tr class="title">
							<td colspan="2">收派时间信息</td>
							<input type="hidden" name="id"/>
						</tr>
						<tr>
							<td>时间名称</td>
							<td>
								<input type="text" name="name" class="easyui-validatebox" required="true" />
							</td>
						</tr>
						<tr>
							<td>平时上班时间</td>
							<td>
								<input type="text" name="normalWorkTime" class="easyui-validatebox" required="true" />
							</td>
						</tr>
						<tr>
							<td>平时休息时间</td>
							<td>
								<input type="text" name="normalDutyTime" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
						<tr>
							<td>周六上班时间</td>
							<td>
								<input type="text" name="satWorkTime" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
						<tr>
							<td>周六上班时间</td>
							<td>
								<input type="text" name="satDutyTime" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
						<tr>
							<td>周日上班时间</td>
							<td>
								<input type="text" name="sunWorkTime" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
						<tr>
							<td>周日休息时间</td>
							<td>
								<input type="text" name="sunDutyTime" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
						<tr>
							<td>状态</td>
							<td>
								<input type="text" name="status" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
						<tr>
							<td>所属单位</td>
							<td>
								<input type="text" name="company" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
						<tr>
							<td>操作人</td>
							<td>
								<input type="text" name="operator" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
						<tr>
							<td>操作单位</td>
							<td>
								<input type="text" name="operatingCompany" class="easyui-validatebox" required="true"/>
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</body>
</html>
